package com.fd.wpx.sso.web.utils;

import com.fd.wpx.blog.pojo.SysUser;
import org.apache.commons.beanutils.BeanUtils;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * 将request域中的对象映射
 */
public class RequestToBean {
    public static SysUser request2bean(HttpServletRequest request){
        SysUser user=new SysUser();
        Map map=request.getParameterMap();
        try {
            BeanUtils.populate(user,map);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return user;
    }
}
